#!/bin/sh
#mkdir -p darwin_x86_64
#mkdir -p darwin
cd ../../
mkdir -p lib/osx
cd tensorflow
bazel build --verbose_failures -c opt --cpu=darwin --cxxopt='--std=c++11' //tensorflow/tfliteextern:libtfliteextern.so
cp -f bazel-bin/tensorflow/tfliteextern/libtfliteextern.so ../lib/osx/libtfliteextern.dylib
#cp -f bazel-bin/tensorflow/tfliteextern/libtfliteextern.so ../platforms/osx/darwin_x86_64/libtfliteextern.dylib

#bazel build -c opt --cpu=darwin --cxxopt='--std=c++11' //tensorflow/tfliteextern:libtfliteextern.so
#cp -f bazel-bin/tensorflow/tfliteextern/libtfliteextern.so ../platforms/osx/darwin/libtfliteextern.dylib

cd ..
#mkdir -p lib/osx
#cp tensorflow/bazel-bin/tensorflow/tfextern/libtfextern.so lib/osx/libtfextern.dylib
chmod u+w lib/osx/libtfliteextern.dylib
install_name_tool -id @rpath/libtfliteextern.dylib lib/osx/libtfliteextern.dylib
#install_name_tool -change @rpath/libtensorflow_framework.so @rpath/libtensorflow_framework.dylib lib/osx/libtfextern.dylib
chmod u-w lib/osx/libtfliteextern.dylib


